#include <stdio.h>

#define max 8
void mysort(int *arr,int low,int high);
int main(int argc, const char *argv[])
{
	int arr[max]={11,55,33,99,77,22,44,66};
	mysort(arr,0,max-1);
	for(int i=0;i<8;i++)
	{
		printf("%d ",arr[i]);
	}
	puts("");
	return 0;
}

void mysort(int *arr,int low,int high)
{
	if(low>=high)
	{
		return ;
	}
	int flag=arr[low];
	int a=low;
	int b=high;
	while(low!=high)
	{
		while(low!=high&&flag>=arr[high])
		{
			high--;
		}
		if(low<high)
		{
			arr[low]=arr[high];
			low++;
		}
		while(low!=high&&flag<=arr[low])
		{
			low++;
		}
		if(low<high)
		{
			arr[high]=arr[low];
			high--;
		}
	}
	arr[low]=flag;

	mysort(arr,a,low-1);
	mysort(arr,low+1,b);

	return ;
}
